<!DOCTYPE html>
<html>
<head>
<title>北京赛车欢乐无限</title>
<meta charset="utf-8">
<meta name="viewport"
	content="initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no" />

<script type="text/javascript"
	src="//cdn.css.net/libs/jquery/2.2.3/jquery.min.js"></script>
<script type="text/javascript"
	src="${base}/assets/layui/layui.js"></script>
<script type="text/javascript"
	src="${base}/assets/layer/layer.js"></script>
<script type="text/javascript" src="${base}/assets/award.js"></script>
<link rel="stylesheet" href="${base}/assets/layui/css/layui.css">
<link rel="stylesheet" href="${base}/assets/style/css/style.css">
<link rel="stylesheet" href="${base}/assets/style/css/lishi.css">
</head>
<body>
	<div class="daojishi">
		<div class="fl">
			<em id="period">${period!0}</em>期开奖剩余：<span id="time"></span>
		</div>
	</div>
	<div style="height:40px;">
		<input id="userid" type="hidden" value="${userid!0}">
	</div>
	<div class="carlist">
		<ul class="kaij-mylist">
			<li class="kaij-mylist-li">
				<div class="kaij-mylist-l nums">
					<i class="ui-logo no1">1</i>
				</div>
				<div class="kaij-mylist-r">
					<div class="itm-time">
						<div class="itm-tit car1"></div>
						<div class="spinner">
							<button class="decrease">-</button>
							<input type="text" class="spinner value" disabled="disabled"
								value="0" data="1">
							<button class="increase">+</button>
						</div>
						<button
							class="sub-btn layui-btn layui-btn-disabled layui-btn-small"
							disabled="disabled">加油</button>
					</div>
				</div>
			</li>
			<li class="kaij-mylist-li">
				<div class="kaij-mylist-l nums">
					<i class="ui-logo no2">2</i>
				</div>
				<div class="kaij-mylist-r">
					<div class="itm-time">
						<div class="itm-tit car2"></div>
						<div class="spinner">
							<button class="decrease">-</button>
							<input type="text" class="spinner value" disabled="disabled"
								value="0" data="2">
							<button class="increase">+</button>
						</div>
						<button
							class="sub-btn layui-btn layui-btn-disabled layui-btn-small"
							disabled="disabled">加油</button>
					</div>
				</div>
			</li>
			<li class="kaij-mylist-li">
				<div class="kaij-mylist-l nums">
					<i class="ui-logo no3">3</i>
				</div>
				<div class="kaij-mylist-r">
					<div class="itm-time">
						<div class="itm-tit car3"></div>
						<div class="spinner">
							<button class="decrease">-</button>
							<input type="text" class="spinner value" disabled="disabled"
								value="0" data="3">
							<button class="increase">+</button>
						</div>
						<button
							class="sub-btn layui-btn layui-btn-disabled layui-btn-small"
							disabled="disabled">加油</button>
					</div>
				</div>
			</li>
			<li class="kaij-mylist-li">
				<div class="kaij-mylist-l nums">
					<i class="ui-logo no4">4</i>
				</div>
				<div class="kaij-mylist-r">
					<div class="itm-time">
						<div class="itm-tit car4"></div>
						<div class="spinner">
							<button class="decrease">-</button>
							<input type="text" class="spinner value" disabled="disabled"
								value="0" data="4">
							<button class="increase">+</button>
						</div>
						<button
							class="sub-btn layui-btn layui-btn-disabled layui-btn-small"
							disabled="disabled">加油</button>
					</div>
				</div>
			</li>
			<li class="kaij-mylist-li">
				<div class="kaij-mylist-l nums">
					<i class="ui-logo no5">5</i>
				</div>
				<div class="kaij-mylist-r">
					<div class="itm-time">
						<div class="itm-tit car5"></div>
						<div class="spinner">
							<button class="decrease">-</button>
							<input type="text" class="spinner value" disabled="disabled"
								value="0" data="5">
							<button class="increase">+</button>
						</div>
						<button
							class="sub-btn layui-btn layui-btn-disabled layui-btn-small"
							disabled="disabled">加油</button>
					</div>
				</div>
			</li>
			<li class="kaij-mylist-li">
				<div class="kaij-mylist-l nums">
					<i class="ui-logo no6">6</i>
				</div>
				<div class="kaij-mylist-r">
					<div class="itm-time">
						<div class="itm-tit car6"></div>
						<div class="spinner">
							<button class="decrease">-</button>
							<input type="text" class="spinner value" disabled="disabled"
								value="0" data="6">
							<button class="increase">+</button>
						</div>
						<button
							class="sub-btn layui-btn layui-btn-disabled layui-btn-small"
							disabled="disabled">加油</button>
					</div>
				</div>
			</li>
			<li class="kaij-mylist-li">
				<div class="kaij-mylist-l nums">
					<i class="ui-logo no7">7</i>
				</div>
				<div class="kaij-mylist-r">
					<div class="itm-time">
						<div class="itm-tit car7"></div>
						<div class="spinner">
							<button class="decrease">-</button>
							<input type="text" class="spinner value" disabled="disabled"
								value="0" data="7">
							<button class="increase">+</button>
						</div>
						<button
							class="sub-btn layui-btn layui-btn-disabled layui-btn-small"
							disabled="disabled">加油</button>
					</div>
				</div>
			</li>
			<li class="kaij-mylist-li">
				<div class="kaij-mylist-l nums">
					<i class="ui-logo no8">8</i>
				</div>
				<div class="kaij-mylist-r">
					<div class="itm-time">
						<div class="itm-tit car8"></div>
						<div class="spinner">
							<button class="decrease">-</button>
							<input type="text" class="spinner value" disabled="disabled"
								value="0" data="8">
							<button class="increase">+</button>
						</div>
						<button
							class="sub-btn layui-btn layui-btn-disabled layui-btn-small"
							disabled="disabled">加油</button>
					</div>
				</div>
			</li>
			<li class="kaij-mylist-li">
				<div class="kaij-mylist-l nums">
					<i class="ui-logo no9">9</i>
				</div>
				<div class="kaij-mylist-r">
					<div class="itm-time">
						<div class="itm-tit car9"></div>
						<div class="spinner">
							<button class="decrease">-</button>
							<input type="text" class="spinner value" disabled="disabled"
								value="0" data="9">
							<button class="increase">+</button>
						</div>
						<button
							class="sub-btn layui-btn layui-btn-disabled layui-btn-small"
							disabled="disabled">加油</button>
					</div>
				</div>
			</li>
			<li class="kaij-mylist-li">
				<div class="kaij-mylist-l nums">
					<i class="ui-logo no10">10</i>
				</div>
				<div class="kaij-mylist-r">
					<div class="itm-time">
						<div class="itm-tit car10"></div>
						<div class="spinner">
							<button class="decrease">-</button>
							<input type="text" class="spinner value" disabled="disabled"
								value="0" data="10">
							<button class="increase">+</button>
						</div>
						<button
							class="sub-btn layui-btn layui-btn-disabled layui-btn-small"
							disabled="disabled">加油</button>
					</div>
				</div>
			</li>
		</ul>
	</div>
	<div class="footer-nav">
		<ul class="layui-nav">
			<li class="layui-nav-item layui-this"><a href="javascript:;">首页</a></li>
			<li class="layui-nav-item"><a href="${rukou}?url=${domain}/zhibo">直播</a></li>
			<li class="layui-nav-item"><a href="${rukou}?url=${domain}/lishi">往期</a></li>
			<li class="layui-nav-item"><a href="${rukou}?url=${domain}/erweima">代理</a></li>
			<li class="layui-nav-item"><a href="${rukou}?url=${domain}/geren">我的</a></li>
		</ul>
	</div>
<script type="text/javascript">

	$(document).ready(function() {
		showCountDown(${afterTime!0}, ${period!0});
		
		window.setTimeout(awardTick, 1000);
	    //每1秒刷新开奖时间数据
	    window.setTimeout(loadAwardTimes, 1000);
	    //初始化按钮事件
    	initEvent();
	});
	
	function initEvent(){
		var step = 10;
		//减号
		$(".decrease").on('click',function(){
			var input = $(this).parent().find("input");
			var innum = Number(input.val());
			if(innum>0){
				input.val(innum-step);
			}
		});
		//加号
		$(".increase").on('click',function(){
			var input = $(this).parent().find("input");
			var innum = Number(input.val());
			if(innum<100){
				input.val(innum+step);
			}
		});
		//提交投注
		$(".sub-btn").on('click',function(){
			var input = $(this).parent().find("input");
			var innum = Number(input.val());
			var carno = Number(input.attr("data"));
			if(innum>0){
				$.post("saveFlowing.do", {
					userid : $("#userid").val(),
					termNum : $("#period").html(),
					carNum : carno,
					buyAmount : innum
				}, function(data) {
					if (parseInt(data.agent) < 5) {
	                    alert("您的微信版本低于5.0无法使用微信支付。");
	                    return;
	                }
					//layer.open({content:'加油成功！',time: 2});	
					callpay({
	                    "appId" : ""+data.appId.toString(), //公众号名称，由商户传入  
	                    "timeStamp" : ""+data.timeStamp.toString(), //时间戳，自 1970 年以来的秒数  
	                    "nonceStr" : ""+data.nonceStr.toString(), //随机串  
	                    "package" : ""+data.packageValue.toString(), //商品包信息
	                    "signType" : ""+data.signType.toString(), //微信签名方式:  
	                    "paySign" : ""+data.paySign.toString() //微信签名  
	                });
				});
			}else{
				layer.open({content:'加油数量不能为零！',time: 2});	
			}
		});
	}
	
	function callpay(json){
		WeixinJSBridge.invoke('getBrandWCPayRequest',json,
	        function(res){
	            if(res.err_msg == "get_brand_wcpay_request:ok"){
					layer.open({content:'加油成功！',time: 2});		
				}else{
					layer.open({content:'支付失败！',time: 2});	
				}
	        }
	    );
	}
</script>
</body>
</html>
